package cn.lh.contants;

/**
 * @描述:
 * @版权: Copyright (c) 2023
 * @作者: linhong
 * @版本: 1.0.0
 * @创建时间: 2023/12/15
 */
public class ErrorCode {
    private final int code;
    private String message;

    public static final ErrorCode INTERNAL_SERVER_ERROR = new ErrorCode(500, "服务器出小差了，请重试");
    public static final ErrorCode ERROR = new ErrorCode(502, "系统异常");
    public static final ErrorCode TIME_OUT = new ErrorCode(503, "连接超时");
    public static final ErrorCode SUCCESS = new ErrorCode(200, "success");
    public static final ErrorCode PARAM_ERROR = new ErrorCode(300, "参数错误");
    public static final ErrorCode BAD_REQUEST = new ErrorCode(400, "Bad Request.");

    public static final ErrorCode USER_NAME_PASSWORD_ERROR = new ErrorCode(500, "用户名或密码错误");
    public static final ErrorCode USER_NOT_LOGIN = new ErrorCode("用户未登录");
    public static final ErrorCode USER_NAME_EXIST = new ErrorCode("用户已存在");
    public static final ErrorCode ORDER_NOT_EXISTS_ERROR = new ErrorCode("订单不存在");

    public ErrorCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public ErrorCode(String message) {
        this.code = 500;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
